/* 调整工具栏布局 */
:host ::ng-deep app-toolbar {
  .center-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 0 16px;

    button {
      flex-shrink: 0;
    }

    nz-select {
      min-width: 120px;
      flex-shrink: 0;
    }
  }
}

.search-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0;
}

.search-input {
  width: 100%;

  :global {
    .ant-input {
      height: 40px;
      font-size: 14px;
      border-radius: 6px;
      padding: 4px 11px 4px 40px;
    }

    .ant-input-prefix {
      color: rgba(0, 0, 0, 0.45);
      font-size: 16px;
      margin-right: 8px;
      margin-left: 12px;
    }

    .ant-input-affix-wrapper {
      border-radius: 6px;

      &:hover, &:focus {
        border-color: #40a9ff;
        box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
      }
    }
  }
}

@media screen and (max-width: 768px) {
  .search-wrapper {
    max-width: 100%;
    padding: 12px 16px;
  }
}

.alert-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.alert-card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #ff4d4f;
  transition: all 0.3s;

  &:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  }

  ::ng-deep .ant-card-body {
    padding: 12px 16px;
  }

  .alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;

    .alert-info {
      flex: 1;

      .alert-labels {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;

        nz-tag {
          margin: 0;
          border-radius: 2px;
        }
      }

      .alert-meta-info {
        display: flex;
        gap: 16px;
        margin-top: 8px;
        color: #8c8c8c;
        font-size: 12px;

        i {
          margin-right: 4px;
        }

        .alert-time {
          display: flex;
          align-items: center;
        }
      }
    }

    .alert-actions {
      display: flex;
      gap: 8px;
      margin-left: 16px;
      flex-shrink: 0;

      button {
        padding: 4px 8px;
        height: 28px;

        i {
          font-size: 14px;
        }
      }
    }
  }

  .alert-details {
    margin-top: 12px;

    ::ng-deep {
      .ant-collapse {
        background: transparent;
        border: none;

        .ant-collapse-item {
          border-radius: 2px;
          border: 1px solid #f0f0f0;
          margin-bottom: 8px;

          &:last-child {
            margin-bottom: 0;
          }

          .ant-collapse-header {
            padding: 8px 12px;
            align-items: center;
            cursor: pointer;

            &:hover {
              background-color: #fafafa;
            }

            .ant-collapse-header-text {
              flex: 1;
            }

            .ant-collapse-extra {
              margin: 0;
              color: #8c8c8c;
              font-size: 12px;
            }

            .alert-content {
              font-size: 13px;
              color: #333;
              line-height: 1.5;
            }
          }

          .ant-collapse-content {
            border-top: 1px solid #f0f0f0;

            .ant-collapse-content-box {
              padding: 12px;
            }
          }
        }
      }
    }

    .detail-section {
      margin-bottom: 16px;

      &:last-child {
        margin-bottom: 0;
      }

      .section-title {
        font-size: 13px;
        color: #595959;
        margin-bottom: 8px;
        font-weight: 500;
      }

      .alert-count {
        display: flex;
        align-items: center;
        color: #8c8c8c;
        font-size: 12px;
      }
    }

    .alert-annotations {
      .annotation-item {
        display: flex;
        margin-bottom: 4px;
        font-size: 13px;

        &:last-child {
          margin-bottom: 0;
        }

        .annotation-key {
          color: #8c8c8c;
          margin-right: 8px;
          min-width: 80px;
        }

        .annotation-value {
          color: #262626;
          flex: 1;
        }
      }
    }

    .time-info {
      .time-item {
        display: flex;
        margin-bottom: 4px;
        font-size: 13px;

        &:last-child {
          margin-bottom: 0;
        }

        .time-label {
          color: #8c8c8c;
          margin-right: 8px;
          min-width: 80px;
        }

        .time-value {
          color: #262626;
        }
      }
    }
  }
}

.pagination {
  margin: 16px;
  text-align: right;
}

.alert-card {
  &.status-firing {
    border-left-color: #ff4d4f;
  }

  &.status-resolved {
    border-left-color: #52c41a;
  }

  &.status-pending {
    border-left-color: #faad14;
  }
}
